package ai.peanut.one.api.mq.mqtest1;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
@Component
public class HelloSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send() {
        String context = "hello " + new Date();
        System.out.println("Sender : " + context);

        for( int i = 0 ; i <  100 ; i ++ ){
            this.rabbitTemplate.convertAndSend("hello", i+"--------"+context);
        }

    }

}
